#include "trainstatusview.h"

TrainStatusView::TrainStatusView(QWidget *parent)
    : QWidget{parent}
{
    setUI();
}

void TrainStatusView::setUI()
{

    qtbWidget = new QWidget(this);
    qtbWidget->setGeometry(0, 0, 66, 62);
    qtbWidget->setFixedSize(66,62);

    topLabel = new QLabel(qtbWidget);
    topLabel->setGeometry(0, 0, 66, 31);
    topLabel->setScaledContents(true);


    noWidget = new QWidget(this);
    noWidget->setGeometry(66, 0, 46, 62);
    noWidget->setFixedSize(46,62);

    atcWidget = new AtcWidget(this);
    atcWidget->setObjectName("atcWidget");
    atcWidget->setGeometry(110, 0, 46, 62);
    atcWidget->setFixedSize(46,62);

    //水平布局
    hLayout = new QHBoxLayout();
    hLayout->setSpacing(0);
    hLayout->setContentsMargins(156,0,0,0);
    setLayout(hLayout);

    for (int i = 0; i < 5; i++) {
        label[i] = new QLabel();
        hLayout->addWidget(label[i],i==1?72:46);
    }

}

AtcWidget::AtcWidget(QWidget *parent): QWidget{parent}
{

    topWidget = new QWidget(this);
    topWidget->setGeometry(13,2,20,20);
    topWidget->setObjectName("atcTopWidget");
    topWidget->setStyleSheet("QWidget {background-color:red;border-top-left-radius:10px;border-top-right-radius:10px;}");



    topLabel = new QLabel(topWidget);
    topLabel->setText("A");
    topLabel->setGeometry(0,0,20,20);
    topLabel->setAlignment(Qt::AlignCenter);
    topLabel->setStyleSheet("QLabel {background-color:transparent;font-size: 12px;color: black;}");

    centerWidget = new QWidget(this);
    centerWidget->setGeometry(13,22,20,20);
    centerWidget->setStyleSheet("QWidget {background-color:rgb(51,59,45);}");


    bottomWidget = new QWidget(this);
    bottomWidget->setGeometry(13,42,20,20);
    bottomWidget->setStyleSheet("QWidget {background-color:red;border-bottom-left-radius:10px;border-bottom-right-radius:10px;}");

    bottomLabel = new QLabel(bottomWidget);
    bottomLabel->setText("B");
    bottomLabel->setGeometry(0,0,20,20);
    bottomLabel->setAlignment(Qt::AlignCenter);
    bottomLabel->setStyleSheet("QLabel {background-color:transparent;font-size: 12px;color: black;}");
}





